function  [lle]=ChoiceProb_mixed_FEdemoshrt_grID_wtp(param)


global state week J T S MT ISTvector K WB...
price_num rebate_estar_num kwh_num elec_num estar_num standard0_num standard10_num standard15_num standard20_num standard25_num rank_num ...
price_denom rebate_estar_denom rebate_denom kwh_denom elec_denom estar_denom standard0_denom standard10_denom standard15_denom standard20_denom standard25_denom rank_denom ...
bchoice bchoice_s bchoice_ij id_i id_j id_ij id_m id_n  demo pidnest choicenest_ij brandweek_denom brandweek_num prod_denom prod_num denom_tmp2 denom_tmp3 denom...
type_id2_3_demo1_num type_id2_3_demo1_denom type_id3_demo1_num type_id3_demo1_denom AV_demo1_num AV_demo1_denom  ice_sc_demo1_num ice_sc_demo1_denom...
type_id2_3_demo2_num type_id2_3_demo2_denom type_id3_demo2_num type_id3_demo2_denom AV_demo2_num AV_demo2_denom  ice_sc_demo2_num ice_sc_demo2_denom...
type_id2_3_demo3_num type_id2_3_demo3_denom type_id3_demo3_num type_id3_demo3_denom AV_demo3_num AV_demo3_denom  ice_sc_demo3_num ice_sc_demo3_denom...
type_id2_3_demo4_num type_id2_3_demo4_denom type_id3_demo4_num type_id3_demo4_denom AV_demo4_num AV_demo4_denom  ice_sc_demo4_num ice_sc_demo4_denom...
type_id2_3_demo5_num type_id2_3_demo5_denom type_id3_demo5_num type_id3_demo5_denom AV_demo5_num AV_demo5_denom  ice_sc_demo5_num ice_sc_demo5_denom...
type_id2_3_demo6_num type_id2_3_demo6_denom type_id3_demo6_num type_id3_demo6_denom AV_demo6_num AV_demo6_denom  ice_sc_demo6_num ice_sc_demo6_denom;

global N_id_denom;
global seq1_Ndraws seq2_Ndraws;
global nb_draws;
global max_size;
global id_dense_i id_dense_j id_dense_ij id_dense_m id_dense_n;
global LLC_5_18;

 %Parameters
  %alpha0=param(1);
  alpha=[0;param(1:J-1,1)];
  eta_m=param(J,1);
  tau=param(J+1,1);
  pi=param(J+2,1);
  theta_m=param(J+3,1);
  beta=param(J+4:J+15,1);
  cov_L1=param(J+16,1);
  cov_L21=param(J+17,1);
  cov_L22=param(J+18,1);
  

  eta_tmp1=eta_m+cov_L1*seq1_Ndraws';
  theta_tmp1=theta_m+cov_L21*seq1_Ndraws'+cov_L22*seq2_Ndraws';

  %tic
  %eta_J=repmat(eta_tmp3,max_size,1);
  %theta_J=repmat(theta_tmp3,max_size,1);
  %toc
  MaxSizevec=ones(max_size,1);
  %tic
  %eta_J_2=kron(eta_tmp3,MaxSizevec);
  %theta_J_2=kron(theta_tmp3,MaxSizevec);
  %toc
  %tic
  %eta_J_3=bsxfun(@times,MaxSizevec,eta_tmp3);
  %theta_J_3=bsxfun(@times,MaxSizevec,theta_tmp3);
  %toc
  %tic
   eta_J=eta_tmp1(MaxSizevec,:);
   theta_J=theta_tmp1(MaxSizevec,:);
  %toc
   
  %tic
  eta_denom=eta_J(id_dense_ij);
  eta_num=eta_tmp1';
  %toc
  clear eta_J eta_tmp1;
  
  %tic
  theta_denom=theta_J(id_dense_ij);
  theta_num=theta_tmp1';
  clear theta_J theta_tmp1;
  %toc
  
  %tic
  FEprod_denom=alpha(prod_denom); 
  FEprod_num=alpha(prod_num); 
  %toc
  
 %Computations 
 %tic
 denom_tmp1= FEprod_denom+eta_denom.*price_denom+eta_denom.*pi.*rebate_estar_denom + eta_denom.*tau(1).*estar_denom+eta_denom.*theta_denom.*elec_denom*LLC_5_18...
  				+beta(1)*type_id2_3_demo1_denom +beta(2)*type_id2_3_demo2_denom + beta(3)*type_id2_3_demo3_denom...
  				+beta(4)*type_id2_3_demo4_denom +beta(5)*type_id2_3_demo5_denom + beta(6)*type_id2_3_demo6_denom...
				+beta(7)*AV_demo1_denom +beta(8)*AV_demo2_denom + beta(9)*AV_demo3_denom...
  				+beta(10)*AV_demo4_denom +beta(11)*AV_demo5_denom + beta(12)*AV_demo6_denom;
 %toc 
 
  denom_tmp2=exp(denom_tmp1);

 %tic
  denom_tmp3 = sparse(id_dense_i,id_dense_j,denom_tmp2,id_dense_m,id_dense_n)';
  denom=sum(denom_tmp3,2);
%toc

%tic
  num=FEprod_num+eta_num.*price_num+eta_num.*pi.*rebate_estar_num +eta_num.*tau(1).*estar_num+eta_num.*theta_num.*elec_num*LLC_5_18...
  				+beta(1)*type_id2_3_demo1_num +beta(2)*type_id2_3_demo2_num + beta(3)*type_id2_3_demo3_num...
  				+beta(4)*type_id2_3_demo4_num +beta(5)*type_id2_3_demo5_num + beta(6)*type_id2_3_demo6_num...
				+beta(7)*AV_demo1_num +beta(8)*AV_demo2_num + beta(9)*AV_demo3_num...
  				+beta(10)*AV_demo4_num +beta(11)*AV_demo5_num + beta(12)*AV_demo6_num;
%toc
%tic
  ChoiceProb_long=exp(num)./denom;
  ChoiceProb_NR=reshape(ChoiceProb_long,MT,nb_draws);
  ChoiceProb_N=(1/nb_draws)*sum(ChoiceProb_NR,2);
%toc  
  logChoiceProb=log(ChoiceProb_N); 
  lle=-sum(logChoiceProb,1);
  
  
end 











